using System.Collections.Generic;

public class BindContext<VMType> : BaseContext where VMType : BaseViewModel
{
    private List<IBuild> builderList;

    public VMType ViewModel { get; private set; }

    public BindContext(VMType viewModel)
    {
        ViewModel = viewModel;
        builderList = new List<IBuild>();
    }

    public BindBuilder<ForType, VMType> Bind<ForType>(ForType target) where ForType : class
    {
        BindBuilder<ForType, VMType> builder = new BindBuilder<ForType, VMType>(target, ViewModel);
        builderList.Add(builder);
        return builder;
    }

    public void Build()
    {
        foreach (IBuild builder in builderList)
        {
            builder.Build();
        }
    }
}
